<?php

require_once 'database.php';
require_once 'common.php';

$intStoryId = isset($_GET['id']) ?htmlspecialchars($_GET['id']) : 0;

$story = getStoryFromId($intStoryId);

function getStoryFromId($intStoryIdParam){
	
	//Get the project from the database based on the ID
	$objStory = array();  //This will sit in memory waiting to be referenced by the HTML
	$objStory['story_name'] = "New Story";
	$objStory['story_desc'] = "New Story Description";
	$objStory['iteration_id'] = '0';
	$objStory['story_id'] = 0;

	//If the value of the project id is 0, then we are creating a new project
	if($intStoryIdParam != 0){
		$dbResult = mysql_query("SELECT * FROM story WHERE story_id = '$intStoryIdParam'");
		$row = mysql_fetch_array($dbResult);

		$objStory['story_id'] = $row['story_id'];
		$objStory['story_name'] = $row['story_name'];
		$objStory['story_desc'] = $row['story_desc'];
		$objStory['iteration_id'] = $row['iteration_id'];
		
		
	}
	
	return $objStory;
}